<?php
class m_login extends Model{
    var $table = "user";
    
    function cek_user($username,$password){
        $query = $this->db->query("select u.id,u.id_member,u.username,m.nama from user u join member m on u.id_member = m.id where u.username = '$username' and u.password = '". md5($password)."' and u.status = '1'");
        if($query->num_rows()>0){
            $result = $query->result_array();
            
            //Update waktu akses terakhir
            $this->db->query("update user set last_update=now() where id='".$result[0]['id']."'");
            
            return $result;
        }else return FALSE;
    }
}
?>
